Trò chơi đua xe động vật trong UNITY Engine
114.934 lượt xem;
- AnimationTestScriptInspector.cs
- Editor /
- Example /
- Spriter2Unity /
- ThirdParty /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3 using UnityEditor;
4 using System;
5
6 [CustomEditor(typeof(AnimationTestScript))]
7 public class AnimationTestScriptInspector : Editor
8 {
9 public override void OnInspectorGUI()
10 {
11 AnimationTestScript myTarget = (AnimationTestScript)target;
12
13 EditorGUILayout.LabelField("Set a trigger:");
14
15 foreach (AnimationTestScript.TriggerType trigger in Enum.GetValues(typeof(AnimationTestScript.TriggerType)))
16 {
17 if (GUILayout.Button(trigger.ToString()))
18 {
19 myTarget.SetTrigger(trigger);
20 }
21 }
22
23 EditorGUILayout.Space();
24 myTarget.Speed = EditorGUILayout.Slider("Movement Speed", myTarget.Speed, 0, 10);
25 }
26 }
2 using System.Collections;
3 using UnityEditor;
4 using System;
5
6 [CustomEditor(typeof(AnimationTestScript))]
7 public class AnimationTestScriptInspector : Editor
8 {
9 public override void OnInspectorGUI()
10 {
11 AnimationTestScript myTarget = (AnimationTestScript)target;
12
13 EditorGUILayout.LabelField("Set a trigger:");
14
15 foreach (AnimationTestScript.TriggerType trigger in Enum.GetValues(typeof(AnimationTestScript.TriggerType)))
16 {
17 if (GUILayout.Button(trigger.ToString()))
18 {
19 myTarget.SetTrigger(trigger);
20 }
21 }
22
23 EditorGUILayout.Space();
24 myTarget.Speed = EditorGUILayout.Slider("Movement Speed", myTarget.Speed, 0, 10);
25 }
26 }